/*
 * Copyright (C) 2012 Martin Wilsdorf <mwjutils-api@googlecode.com>.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301  USA
 */

package com.google.mwjutils.xcode;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;

/**
 *
 * @author Martin Wilsdorf <mwjutils-api@googlecode.com>
 */
public abstract class XLanguage {

    private Properties fProperties;

    /**
     * Get the value of properties
     *
     * @return the value of properties
     */
    public final Properties getProperties(  ) {
        return fProperties;
    }
    
    /**
     * Calls method of same name of field fProperties with an inizialized
     * file input stream.
     * 
     * @param aFileName
     * @throws FileNotFoundException
     * @throws IOException
     */
    public final void loadFromXML( final String aFileName )
            throws FileNotFoundException, IOException {
        FileInputStream in = new FileInputStream( aFileName );
        fProperties.loadFromXML( in );
    }
    
    /**
     * Calls method of same name of field fProperties with an inizialized
     * file output stream.
     * 
     * @param aFileName
     * @throws FileNotFoundException
     * @throws IOException
     */
    public final void storeToXML( final String aFileName )
            throws FileNotFoundException, IOException {
        FileOutputStream out = new FileOutputStream( aFileName );
        fProperties.storeToXML(out,
                "Language describing content of XLanguage" );
    }

}
